package com.twu.biblioteca.ui;

import com.twu.biblioteca.auth.Authenticator;
import com.twu.biblioteca.auth.User;
import com.twu.biblioteca.io.IO;

public class CheckMembershipDetailsMenuItemHandler implements MenuItemHandler {

    private Authenticator authenticator;
    private IO io;

    public CheckMembershipDetailsMenuItemHandler(Authenticator authenticator, IO io) {
        this.authenticator = authenticator;
        this.io = io;
    }

    @Override
    public void handle() {
        User user = authenticator.getLoggedInUser();
        if (user != null) {
            io.writeOutput(user);
        } else {
            io.writeOutput("Please talk to a Librarian. Thank you.");
        }
    }
}
